
import { Text, View, Image } from '@tarojs/components'
import { ViewProps } from '@tarojs/components/types/View'
import Taro from '@tarojs/taro'
import React from 'react'



type props = {
    icon: string,
    title: string,
    onClick()
}

export default (props: props) => {
    return (
        <View style={styles.headerLeft} onClick={e => {
            e.stopPropagation()
            props.onClick();
        }}>
            <Image style={{ width: '22px', height: '22px', marginRight: '10px',display:'flex', flexShrink: 0 }} src={props.icon}  mode='aspectFit'/>
            <Text style={{flex:1,...styles.titleStyle}} className='oneLine'>{props.title}</Text>
        </View>
    )
}

const styles: Record<string, React.CSSProperties> = {

    headerLeft: {
        maxWidth: 'calc(100vw - 150px)',
        minWidth: '70px',
        height: '100%',
        backgroundColor: 'transparent',
        display: 'flex',
        flexShrink: 0,
        alignItems: 'center',
        paddingLeft: '15px',
    },
    titleStyle: {
        fontSize: '16px',
        color: '#333333',
    },
}